package com.sixth.controller;

import com.sixth.service.MenuService;
import com.sixth.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project01
 * @description:
 * @author: 高振杨
 * @create: 2021-12-16 19:45
 **/
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private MenuService menuService;

    @RequestMapping("/children")
    public CommonResult Findchildren(){
        return menuService.findByUserRid();
    }

    //树形菜单
    @RequestMapping("treeMenu")
    public CommonResult treeMenu(){
        return menuService.findAllMenu();
    }
    //获取默认被选中的菜单
    @RequestMapping("findRoleMenuId")
    public CommonResult findRoleMenuId(Integer roleid){
        return menuService.findRoleMenuId(roleid);
    }
    //修改权限
    @RequestMapping("updatePermission")
    public CommonResult updatePermission(Integer roleid,String midArr){
        String[] mids = midArr.split(",");
        return menuService.confirmPermission(roleid,mids);
    }

}
